﻿using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
using Tycho.Runtime;

namespace Tycho.Peyote {
    /// <summary>
    /// Interaction logic for GlyphOptions.xaml
    /// </summary>
    public partial class GlyphOptions {
        public Environment Environment { get; set; }

        public GlyphOptions (Environment environment) {
            InitializeComponent ();

            Environment = environment;
        }

        public override AnyObject RuntimeValue {
            get { return RuntimeModule.Null; }
        }

        public override GlyphHandle GlyphHandle { get; set; }
    }

    public class SymbolToStringConverter : IValueConverter {
        public object Convert (object value, Type targetType, object parameter, CultureInfo culture) {
            if (value != null) {
                return value.ToString ();
            } else {
                return "";
            }
        }

        public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) {
            return Symbol.Parse (value.ToString (), Environment.PeyoteNamespace);
        }
    }
}
